// 获取内置伪静态规则
$.ajax({
    url: '/GetRewriteList/',
    type: 'POST',
    success: function (data) {
        // 创建下拉框
        var select = document.getElementById("GetRewriteList");
        // 循环添加选项
        for (var i = 0; i < data.length; i++) {
        var option = document.createElement("option");
        option.value = data[i];
        option.innerHTML = data[i];
        select.appendChild(option);
        }
       // 获取当前目录
        select.value = data[0];
        
    }
});
window.onload = function() {  
    var value = '/';
    $.ajax({
        url: '/GetRewriteList/GetFileBody',
        type: 'POST',
        data: {
            'path': value
        },
        success: function (data) {
            document.getElementById("desc").value = data.data;
        }
    });  
};
// 改变页面框伪静态内容
function GetFileBody() {
    var select = document.getElementById("GetRewriteList");
    var value = select.options[select.selectedIndex].value;
    $.ajax({
        url: '/GetRewriteList/GetFileBody',
        type: 'POST',
        data: {
            'path': value
        },
        success: function (data) {
            document.getElementById("desc").value = data.data;
        }
    });
}
// 保存伪静态
function SaveFileBody() {
    var desc = document.getElementById("desc");
    $.ajax({
        url: '/GetRewriteList/SaveFileBody',
        type: 'POST',
        data: {
            'data': desc.value
        },
        success: function (data) { 
            layer.msg(data.msg,{icon: 'success'})
        }
    });
}